<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/Mock.js/1.0.1-beta1/mock-min.js" type="application/javascript"></script>
    <script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/axios/0.26.0/axios.min.js" type="application/javascript"></script>
    <script src="m"></script>
</head>
<body>
    <button id="bt">发送请求</button>
    <script>
        const $api =axios.create({
            baseURL:'https://cnodejs.org/api/v1/'
        })
         document.querySelector('#bt').addEventListener('click', async ()=>{
            const res=await $api.get('topics');
            console.log('请求结果',res)
        })
        // document.querySelector('#bt').addEventListener('click', async ()=>{
        //     const res=await axios.get('https://cnodejs.org/api/v1/topics');
        //     console.log('请求结果',res)
        // })
       
    </script>
    
</body>
</html>